home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 05 - 1989 / 05.03 Mar 89 / Forth Source Code / matmul.f < prev    next >
Encoding:
Text File  |  1989-01-16  |  644 b   |  33 lines  |  [TEXT/MPS ]

  1. !!S matmul
  2.     subroutine matmul (lp,l,mp,m,np,n,c,b,a)
  3. c
  4. c    generates the matrix product c = a*b.
  5. c    a is an input matrix of dimensions m*n, stored in 
  6. c    an array of physical dimensions mp*np.
  7. c    b is an input matrix of dimensions n*l, stored in 
  8. c    an array of physical dimensions np*lp.
  9. c    c is the product matrix of dimensions m*l, stored in 
  10. c    an array of physical dimensions mp*lp.
  11. c
  12. c    J. Langowski 1989
  13. c
  14.     implicit none
  15.     integer*4 np,n,mp,m,lp,l
  16.     real*4 a(mp,np),b(np,lp),c(mp,lp)
  17.     
  18.     real*4 sum
  19.     integer*4 i,j,k
  20.     
  21.     do i=1,l
  22.         do j=1,m
  23.             sum=0.
  24.             do k=1,n
  25.                 sum = sum + a(j,k)*b(k,i)
  26.             end do
  27.             c(j,i) = sum
  28.         end do
  29.     end do
  30.     
  31.     return
  32.     end
  33.